package com.zpc.myvideoserver.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author zpc
 * @since 2023/11/03
 */
@Getter
@Setter
// @Accessors(chain = true)
@TableName("user")
@ApiModel(value = "User对象", description = "用户表")
public class User implements Serializable {

    @ApiModelProperty("用户唯一标识")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("用户名")
    @TableField("`name`")
    private String name;

    @ApiModelProperty("用户密码")
    @TableField("`password`")
    private String password;

    @ApiModelProperty("用户邮箱")
    @TableField("email")
    private String email;

    @ApiModelProperty("用户头像url")
    @TableField("avatar")
    private String avatar;

    @ApiModelProperty("用户权限: normal:普通用户,admin:管理员")
    @TableField("authorities")
    private String authorities;

    @ApiModelProperty("用户注册时间")
    @TableField(value="create_time")
    // format时间
    @JsonSerialize(using = LocalDateTimeSerializer.class)//序列化
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)//反序列化
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
}
